<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    .box {
      width:500px;
      height:100px;
      margin : 200px auto;
      /* background:linear-gradient(渐变的起始位置，起始颜色，结束颜色) */
      background: -webkit-linear-gradient( top, red, green);
      background:-moz-linear-gradient(top,red,green);
      background:-ms-linear-gradient(top,red,green);
    }
    section {
      width:500px;
      height:200px;
      margin:0 auto;
      background:-webkit-linear-gradient(top,red 0%,blue 20%,pink 100%);
      background:-moz-linear-gradient(top,red 0%,green 20%,purple 100%)
    }

  </style>
</head>
<body>
  <div class="box"></div>
  <section></section>
</body>
</html>